// 全局共享数据示例
import { DEFAULT_NAME } from '@/constants';
import { useState } from 'react';

const useUser = () => {
  const [name, setName] = useState<string>(DEFAULT_NAME);
  const [isTour, setIsTour] = useState(localStorage.getItem('tourShown') !== 'false');

  return {
    name,
    setName,
    isTour,
    setIsTour: (val: boolean) => {
      localStorage.setItem('tourShown', `${val}`);
      setIsTour(val);
    }
  };
};

export default useUser;
